<!DOCTYPE html>
<html>

<head>

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">

    <title>获取密码</title>
    <meta name="keywords" content="获取密码">
    <meta name="description" content="获取密码">
    <link rel="shortcut icon" href="favicon.ico">
    <link href="<?= base_url('assets/css/bootstrap.min.css?v=3.3.6') ?>" rel="stylesheet">
    <link href="<?= base_url('assets/css/font-awesome.css?v=4.4.0') ?>" rel="stylesheet">
<!--    <link href="--><?//= base_url('assets/css/plugins/iCheck/custom.css') ?><!--" rel="stylesheet">-->
    <link href="<?= base_url('assets/css/animate.css') ?>" rel="stylesheet">
    <link href="<?= base_url('assets/css/style.css?v=4.1.0') ?>" rel="stylesheet">


    <script>
        if(window.top !== window.self){ window.top.location = window.location;}
    </script>

</head>

<body class="gray-bg">



    <div class="middle-box text-center loginscreen   animated fadeInDown">
        <div>
            <div>

                <div style="margin: 0 auto; width: 300px; height: 200px">

                    <h4 class="logo-name" style="font-size: 100px;">SI18N</h4>

                </div>

            </div>

            <p>获取登录密码</p>
            <form class="m-t" role="form"  id="pform">
                <div class="form-group">
                    <input type="email" name="email" id="email" aria-required="true" class="form-control" placeholder="输入您的邮箱" required="">
                </div>
                <button type="submit" class="btn btn-primary block full-width m-b" id="btn_getpwd">获取密码</button>
                <p class="text-muted text-center"><a href="<?= base_url('login/') ?>">去登录</a>
                </p>

            </form>
        </div>
    </div>

    <!-- 全局js -->

    
    <?php include "include/admin_foot_script.php" ?>

    <script>
        //以下为官方示例
        $().ready(function () {
            var icon = "<i class='fa fa-times-circle'></i> ";
            $("#pform").validate({
                rules: {
                    email: {
                        required: true,
                        email: true
                    }
                },
                messages: {
                    email: icon + "请输入您的E-mail"
                },
                submitHandler: function (form) {
                    getPassword();
                }
            });

        });

        var getPwd = false;
        
        function getPassword() {

            if (getPwd) {
                toastr.warning("正在获取中......", '提示');
                return;
            }

            var email = $("#email").val();
            if (email == '') {
                return;
            }

            $("#btn_getpwd").html("获取中密码中...");

            getPwd = true;
            $.post("<?= base_url('login/sendPwd') ?>", {"loginname": email}, function (res) {
                $("#btn_getpwd").html("获取密码");
                getPwd = false;
                if (res.code == 200) {
                    toastr.success(res.msg, '提示');
                } else {
                    toastr.error(res.msg, '提示');
                }


            }, "json")

        }

    </script>

</body>

</html>
